package wfl.spec.edu;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.List;

public class wechatAdapter extends ArrayAdapter<wechat> {
    private int resourceId;

    public wechatAdapter(Context context, int textViewResourceId, List<wechat> objects){
        super(context, textViewResourceId, objects);
        resourceId= textViewResourceId;
    }
    public View getView(int position,View converView,ViewGroup parent){
        wechat w=getItem(position);
        View view = LayoutInflater.from(getContext()).inflate(resourceId, parent, false);
        TextView wechatTitle=(TextView) view.findViewById(R.id.wechat_title);
        TextView wechatContent=(TextView) view.findViewById(R.id.wechat_content);
        ImageView wechatImage=(ImageView) view.findViewById(R.id.wechat_image);
        wechatTitle.setText(w.getTitle());
        wechatContent.setText(w.getContent());
        wechatImage.setImageResource(w.getImageId());
        return view;
    }

}
